
#pragma once

#include <WinDef.h>

#include "Math\Matrix4x4.h"
#include "Math\Vector4.h"

class Camera
{
public:
	Camera();
	Camera(FLOAT fov, FLOAT width, FLOAT height, FLOAT zmin, FLOAT fplane);
	Camera(FLOAT fov, FLOAT aspect, FLOAT zmin, FLOAT fplane);
	~Camera();

	Camera(const Camera& other);
	Camera& operator = (const Camera& other);

	// Perspective.
	//-----------------------------------------------
	FLOAT FieldOfView() CONST;
	VOID SetFieldOfView(FLOAT fov);

	FLOAT Aspect() CONST;
	VOID SetAspect(FLOAT aspect);
	VOID SetAspect(FLOAT width, FLOAT height);

	FLOAT Near() CONST;
	VOID SetNear(FLOAT z);

	FLOAT Far() CONST;
	VOID SetFar(FLOAT z);
	
	// Position & Rotation.
	//-----------------------------------------------
	Vector4 GetPosition() CONST;
	VOID SetPosition(CONST Vector4& position);
	VOID SetPosition(FLOAT x, FLOAT y, FLOAT z);

	Vector4 GetRotations() CONST;
	VOID SetRotations(CONST Vector4& rotation);
	VOID SetRotations(FLOAT attitude, FLOAT heading, FLOAT bank);
	
	VOID Rotate(CONST Vector4& axis, FLOAT angle);
	VOID Rotate(FLOAT x, FLOAT y, FLOAT z, FLOAT angle);

	VOID Translate(CONST Vector4& vector);
	VOID Translate(FLOAT x, FLOAT y, FLOAT z);
	
	VOID LookAt(CONST Vector4& target);
	VOID LookAt(FLOAT x, FLOAT y, FLOAT z);

	// Matrices.
	//-----------------------------------------------
	CONST Matrix4x4& GetProjection() CONST;
	CONST Matrix4x4& GetView() CONST;

private:
	VOID UpdateProjection() const;

	// Attributes.
	//-----------------------------------------------
	// Perspective.
	FLOAT        	  m_fov;
	FLOAT        	  m_aspect;
	FLOAT	     	  m_zmin;
	FLOAT        	  m_zmax;;

	// Matrices.
	mutable Matrix4x4 m_projection;
	mutable Matrix4x4 m_view;
};

